new Vue({
    el: "#buyCargo",
    data: {
        plist: {}
    },
    methods: {
        getList: function() {
            var _this = this;
            $.get(
                url + "Stock/lists",
                function(ret) {
                    if (ret.status == "success") {
                        _this.plist = ret.data;
                        $('#exampleTablePagination').bootstrapTable({
                            search: true,
                            pagination: true,
                            showRefresh: false,
                            showToggle: false,
                            showColumns: true,
                            iconSize: 'outline',
                            height: 680,
                            columns: [{
                                field: 'id',
                                title: 'ID'
                            }, {
                                field: 'time',
                                title: '时间'
                            }, {
                                field: 'name',
                                title: '种类'
                            }, {
                                field: 'price',
                                title: '价格'
                            }, {
                                field: 'number',
                                title: '数量'
                            }, {
                                field: 'tax',
                                title: '运费'
                            }, {
                                field: 'alltotal',
                                title: '总价'
                            }, {
                            	field: 'operator',
                            	title: '添加人'
                            },{
                                field:'lasteditoperator',
                                title:"最后操作人"
                            },{
                                field:'stillneedtopay',
                                title:"待付款"
                            },{
                                field:"caozuo",
                                title:"操作"
                            }],
                            data: _this.plist
                        });
                    } else if (ret.status == "failed") {
                        layer.msg(ret.data, { icon: 2 });
                        setTimeout(function() {
                            window.location.href = "/h/login.html";
                        }, 1000);
                    }
                }
            );
        },
        refresh: function() {
            window.location.reload();
        }
        // },
        // edit:function(id){
        //     alert(id);
        // }
    },
    ready: function() {
        this.getList();
    }
});

function edit(id){
    parent.layer.open({
        type: 2,
        title: '进货信息修改页',
        shadeClose: true,
        shade: 0.8,
        area: ['70%', '90%'],
        content: ['/h/editbuyer.html?id='+id,'no'] //iframe的url
    });
}